package org.bbs.demo.reply.dao;


import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface DeleteDao {
    @Select("select r_id from bbsreply where r_id = #{r_id}")
    public String FindRId(String r_id);

    @Select("select storey_r_id from storey_reply where storey_r_id = #{storey_r_id}")
    public String FindStoreyRId(String Storey_r_id);

    @Delete("delete from bbsreply where r_id = #{r_id}")
    public int deleteReply(String r_id);

    @Delete("delete from storey_reply where storey_r_id = #{storey_r_id}")
    public int deleteStoreyReply(String storey_r_id);

    @Update("update bbstopic set replys = replys - 1 where topic_id = #{topic_id}")
    public int updateReplyNum(String topic_id);

    @Update("update bbsreply set r_reply_num = r_reply_num - 1 where r_id = #{r_id}")
    public int updateRReplyNum(String r_id);

    @Select("select user_id from storey_reply where storey_r_id = #{storey_r_id}")
    public String FindStoreyReplyUID(String storey_r_id);

    @Select("select user_id from bbsreply where r_id = #{r_id}")
    public String FindReplyUID(String r_id);

    @Select("select topic_id from bbsreply where r_id =#{r_id}")
    public String FindTopicIdFromRId(String r_id);

    @Select("select r_id from storey_reply where storey_r_id =#{storey_r_id}")
    public String FindRIdFromStoreyRId(String storey_r_id);
}
